package com.lagou.edu.ad.controller;

import com.lagou.edu.dto.PromotionSpaceDTO;
import com.lagou.edu.remote.AdRemoteService;
import com.lagou.edu.reponse.ResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 程  林
 * @date 2021-01-22 22:14
 * @description //
 * @since V1.0.0
 */
@RestController
@RequestMapping("/ad")
public class FrontAdController {

    @Autowired
    private AdRemoteService adRemoteService;

    @GetMapping("/getAdBySpaceKey")
    public ResponseDTO<List<PromotionSpaceDTO>> getAdBySpaceKey(@RequestParam(name = "spaceKey") String[] keys) {
        List<PromotionSpaceDTO> adBySpaceKay = adRemoteService.getAdBySpaceKey(keys);
        return ResponseDTO.success(adBySpaceKay);
    }
}
